﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace ST.Buz.Base.Entity
{
	/// <summary>
	/// 微信支付订单
	/// </summary>
	[Table("WX_PayOrder")]
	public partial class WX_PayOrder
	{
		[Key]
		[Column("ID")]
		public int ID { get; set; }

		/// <summary>
		/// 商户订单号（支付订单流水号）
		/// </summary>
		[Column("OutTradeNO")]
		[StringLength(32, ErrorMessage = "{0}长度不能超过{1}")]
		public string OutTradeNO { get; set; }

		/// <summary>
		/// 应用ID
		/// </summary>
		[Column("AppID")]
		[StringLength(32, ErrorMessage = "{0}长度不能超过{1}")]
		public string AppID { get; set; }

		/// <summary>
		/// 商户号
		/// </summary>
		[Column("MchID")]
		[StringLength(32, ErrorMessage = "{0}长度不能超过{1}")]
		public string MchID { get; set; }

		/// <summary>
		/// 交易类型（取值为：JSAPI，NATIVE，APP等）
		/// </summary>
		[Column("TradeType")]
		[StringLength(16, ErrorMessage = "{0}长度不能超过{1}")]
		public string TradeType { get; set; }

		/// <summary>
		/// 交易状态（SUCCESS—支付成功 REFUND—转入退款 NOTPAY—未支付 CLOSED—已关闭 REVOKED—已撤销（刷卡支付）USERPAYING--用户支付中 PAYERROR--支付失败(其他原因，如银行返回失败)）
		/// </summary>
		[Column("TradeState")]
		[StringLength(32, ErrorMessage = "{0}长度不能超过{1}")]
		public string TradeState { get; set; }

		/// <summary>
		/// 交易状态描述
		/// </summary>
		[Column("TradeStateDesc")]
		[StringLength(256, ErrorMessage = "{0}长度不能超过{1}")]
		public string TradeStateDesc { get; set; }

		/// <summary>
		/// 错误代码
		/// </summary>
		[Column("ErrorCode")]
		[StringLength(32, ErrorMessage = "{0}长度不能超过{1}")]
		public string ErrorCode { get; set; }

		/// <summary>
		/// 交易状态描述
		/// </summary>
		[Column("ErrorMsg")]
		[StringLength(128, ErrorMessage = "{0}长度不能超过{1}")]
		public string ErrorMsg { get; set; }

		/// <summary>
		/// 用户openid
		/// </summary>
		[Column("OpenID")]
		[Display(Name = "用户openid")]
		[Required]
		[StringLength(128, ErrorMessage = "{0}长度不能超过{1}")]
		public string OpenID { get; set; }

		/// <summary>
		/// 预支付交易会话标识
		/// </summary>
		[Column("PrepayID")]
		[StringLength(64, ErrorMessage = "{0}长度不能超过{1}")]
		public string PrepayID { get; set; }

		/// <summary>
		/// 设备号
		/// </summary>
		[Column("DeviceInfo")]
		[StringLength(32, ErrorMessage = "{0}长度不能超过{1}")]
		public string DeviceInfo { get; set; }

		/// <summary>
		/// 付款银行
		/// </summary>
		[Column("BankType")]
		[StringLength(16, ErrorMessage = "{0}长度不能超过{1}")]
		public string BankType { get; set; }

		/// <summary>
		/// 用户应付款金额（单位：分）
		/// </summary>
		[Column("DuePay")]
		public int DuePay { get; set; }

		/// <summary>
		/// 标价金额（用户实际支付的总金额，单位：分）
		/// </summary>
		[Column("TotalFee")]
		public int TotalFee { get; set; }

		/// <summary>
		/// 应结订单金额（当订单使用了免充值型优惠券后返回该参数，应结订单金额=订单金额-免充值优惠券金额）
		/// </summary>
		[Column("SettlementTotalFee")]
		public int SettlementTotalFee { get; set; }

		/// <summary>
		/// 用户实际现金支付金额
		/// </summary>
		[Column("CashFee")]
		public int CashFee { get; set; }

		/// <summary>
		/// 代金券金额
		/// </summary>
		[Column("CouponFee")]
		public int CouponFee { get; set; }

		/// <summary>
		/// 代金券使用数量
		/// </summary>
		[Column("CouponCount")]
		public int CouponCount { get; set; }

		/// <summary>
		/// 微信订单号
		/// </summary>
		[Column("TransactionID")]
		[StringLength(32, ErrorMessage = "{0}长度不能超过{1}")]
		public string TransactionID { get; set; }

		/// <summary>
		/// 附加数据（附加数据，原样返回）
		/// </summary>
		[Column("Attach")]
		[StringLength(32, ErrorMessage = "{0}长度不能超过{1}")]
		public string Attach { get; set; }

		/// <summary>
		/// 发起支付时间
		/// </summary>
		[Column("TimeStart")]
		public DateTime TimeStart { get; set; }

		/// <summary>
		/// 支付完成时间（订单支付时间，格式为yyyyMMddHHmmss）
		/// </summary>
		[Column("TimeEnd")]
		public DateTime TimeEnd { get; set; }
	}
}
